package com.zhi.dao;

import com.zhi.entity.HealthInfo;
import com.zhi.entity.User;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface HealthInfoRepository extends JpaRepository<HealthInfo,Integer> {
    @Query(value = "select * from health_info where user_id = ?1 order by makedate desc,maketime desc",
            countQuery ="select count(*) from health_info where user_id = ?1",
            nativeQuery=true)
    public Page<HealthInfo> findAllDesc(Pageable pageable, int userid1);

    @Query(value = "select * from health_info where user_id = ?1 order by makedate,maketime",
    nativeQuery = true)
    public List<HealthInfo> findAllByUserId(int userid1);
}
